package com.zqwh.xtool.converter;

import com.zqwh.xtool.domain.UserVO;
import com.zqwh.xtool.greendao.db.User;

import java.util.ArrayList;
import java.util.List;

public class User2UserVOConverter {
    public static UserVO convert(User user){
        UserVO userVO = new UserVO();
        userVO.setUserId(user.getUserId());
        userVO.setAdmin(user.getIsAdmin());
        userVO.setCardNo(user.getCardNo());
        userVO.setName(user.getName());
        userVO.setTemplate_1(user.getTemplate_1());
        userVO.setTemplate_2(user.getTemplate_2());
        userVO.setTemplate_3(user.getTemplate_3());
        userVO.setTemplate_4(user.getTemplate_4());
        userVO.setUsername(user.getUsername());
        return userVO;
    }

    public static List<UserVO> convert(List<User> userList){
        List<UserVO> userVOList = new ArrayList<>();
        for (User user:userList){
            userVOList.add(convert(user));
        }
        return userVOList;
    }
}
